﻿<!--Libreria de Conexion c24h-->
<?php
//Configuracion de la conexion a base de datos
$bd_host = "localhost";
$bd_usuario = "company2_sistema";
$bd_password = "company24h";
$bd_base = "company2_system";
$con = mysql_connect($bd_host, $bd_usuario, $bd_password);
mysql_select_db($bd_base, $con);

$orden = "ORDER BY `SC`.`descriccion` ASC";

if (isset($_GET['orden'])) {
    $orden = $_GET['orden'];
}

echo '<tbody id="cont-node" >';

$estadoImpreso = 1;


$select_query = "SELECT *
            FROM GW_ListCompany AS LC, GW_StatusCarpetas AS SC
            WHERE LC.IdStatus = SC.id $orden";

$result = mysql_query($select_query, $con);


$estilo = "";
$clasCSS = "";

while ($asociado = mysql_fetch_assoc($result)) {

    if ($asociado['descriccion'] == "Disponible") {
        $estilo = "'color:blue;'";
    } elseif ($asociado['descriccion'] == "Registrada") {

        $estilo = "'color:green;'";
    } elseif ($asociado['descriccion'] == "Vendida") {
        $estilo = "'color:red;'";
    }elseif ($asociado['descriccion'] == "Reservada") {
        $estilo = "'color:green;'";
    }

    if ($estadoImpreso == 1) {

        $clasCSS = "class='tabla-add'";
        $estadoImpreso--;
    } else {

        $clasCSS = "class='tabla-rev'";
        $estadoImpreso++;
    }

    echo "<tr $clasCSS >
                    <th>" . $asociado['Referencia'] . "</th>
                        <td style=$estilo>" . $asociado['descriccion'] . "</td>
                            <td onclick='dialog(" . '"' . $asociado['Referencia'] . '"' . ")'><img alt='Check' src='../public/images/bt_seleccionar.gif'/></td></tr>";
    $con++;
}

echo ' </tbody>
    </table>
</div> ';
?>   

<div id="dialog" style="display:none;" >

    <div id="div-pop-texto" ></div>
    
    <form id="formplace" name="formplace" method="post" action="../public/modelo/ordenesController.php">
        <div class="formulario-c24h">
            <label>Tipo de servicio:</label>
            <select id="typo" name="typo" disabled="true">
                <option value="1">Express</option>
                <option selected="selected" value="0">Constituir Empresa</option>
                <option value="3">OffShore</option>
                <option value="7">Venta - Express</option>
                <option value="8">Registro Offshore</option>
                <option value="9">Registro Nombre</option>
                <option value="10">Transformacion</option>
                <option value="11">Otros</option>
                <option value="12">Registro de Marca</option>
                <option value="13">Disulocion y Liquidacion</option>
                <option value="14">Gestion Cuenta Bancaria Panama</option>
                <option value="15">Propia-BASICA</option>
                <option value="16">Venta-BASICA</option>
                <option value="17">Fundacion</option>
                <option value="18">RNP</option>
            </select>
        </div>
        <div class="formulario-c24h">
            <label>Nombre de Empresa:</label>
            <input type="text" class="c_nombre_c" id="referencia" name="referencia" />
        </div>
        <div class="formulario-c24h">
            <label>Provicia o Ubicación:</label>
            <select name="provincia">
                <option value="1">Distrito Nacional</option>
                <option value="3">Azua</option>
                <option value="4">Bahoruco</option>
                <option value="5">Barahona</option>
                <option value="6">Dajabon</option>
                <option value="7">Duarte</option>
                <option value="8">El Seybo</option>
                <option value="9">Elias Piña</option>
                <option value="10">Espaillat</option>
                <option value="11">Hato Mayor</option>
                <option value="12">Hermanas Mirabal</option>
                <option value="13">Independencia</option>
                <option value="14">La Altagracia</option>
                <option value="15">La Romana</option>
                <option value="16">La Vega</option>
                <option value="17">María Trinidad Sánchez</option>
                <option value="18">Monseñor Nouel</option>
                <option value="19">Monte Cristi</option>
                <option value="20">Monte Plata</option>
                <option value="21">Pedernales</option>
                <option value="22">Peravia</option>
                <option value="23">Puerto Plata</option>
                <option value="24">Samaná</option>
                <option value="25">San Cristóbal</option>
                <option value="26">San José de Ocoa</option>
                <option value="27">San Juan</option>
                <option value="28">San Pedro de Macor&amp;iacute;s</option>
                <option value="29">Sánchez Ramírez</option>
                <option value="30">Santiago</option>
                <option value="31">Santiago Rodríguez</option>
                <option value="32">Santo Domingo</option>
                <option value="33">Valverde</option>
                <option value="34">Fuera del Pais</option>
            </select>
        </div>
        <div class="formulario-c24h">
            <label>Nombre del Contacto:</label>
            <input type="text" class="nombre_contacto" id="nombre" name="nombre"/>
        </div>
        <div class="formulario-c24h">
            <label>Telefono:</label>
            <input type="text" class="tel_contacto" id="telefono2" name="telefono2"/>
        </div>
        <div class="formulario-c24h">
            <label>Celular:</label>
            <input type="text" class="cel_contacto" id="telefono" name="telefono"/>
        </div>
        <div class="formulario-c24h">
            <label>Correo Eletronico:</label>
            <input type="text" class="email" id="email1" name="email1"/>
        </div>
        <div class="formulario-c24h">
            <label>Confirmar Correo:</label>
            <input type="text" class="v_email" id="email2" name="email2"/>
        </div>
        

        
        <div id="div-pop-pasos"></div> <div id="linea-div"> <div>
        
        <div id="div-dialog-cont-boton"><img src="../public/images/bt_continuar.gif" onclick=" if(jQuery('#formplace').valid()){  $('#formplace').submit(); }" alt="Constituir" /></div>
        
    </form>

</div>


<!--Escript-->
<script type="text/javascript">
    $(document).ready(function()
    {
        $('#encabezado-tabla').qtip({
            content: 'Precione Para Ordenar Alfabeticamente',
            position: {
                my: 'top left',
                target: 'mouse',
                viewport: $(window), // Keep it on-screen at all times if possible
                adjust: {
                    x: 10,  y: 10
                }
            },
            hide: {
                fixed: true // Helps to prevent the tooltip from hiding ocassionally when tracking!
            },
            style: 'qtip-shadow'
        });
    });

</script>

<script type="text/javascript">
    
    function dialog(referencia)
    {
        $(function() {
            $( "#dialog" ).dialog({
                title:'Formulario De Servicio',
                autoOpen:true,
                width:435,
                modal:true,
                draggable:false,
                resizable:false,
                show: "fold",
                hide: "scale",
                dialogClass:"dialog"     
            });
        });
        
        
        
        $('#referencia').val(referencia);   
    }
    
    var form = $("#formplace");
    form.validate({
        
        errorElement: "span",
        rules:{
            
            referencia:{
            required:true,
                minlength:5,
                maxlength : 40},
           
            nombre:{
                
                required:true,
                minlength:5,
                maxlength : 40
                
            },
            
            telefono2:{
                
                required:true,
                minlength:10,
                maxlength:20,
                number:true
                
            },
            
            telefono:{
                
                required:true,
                minlength:10,
                maxlength:20,
                number:true
                
            },
            
            email1:{
                required:true,
                  email:true, 
            },
            
            email2:{
                required:true,
              
                equalTo:"#email"
            }
            
        },
        messages:{
        
         referencia:{
                
                required:"Campo Requerido.",
                minlength:"Minimo De Caracteres 5",
                maxlength:"Maximo De caracteres 40"
                
            },
             
            nombre:{
                
                required:"Campo Requerido.",
                minlength:"Minimo De Caracteres 5",
                maxlength:"Maximo De caracteres 40"
                
            },
            
            telefono2:{
                
                required:"Campo Requerido.",
                minlength:"Minimo De Caracteres 10",
                maxlength:"Maximo De caracteres 20",
                number:"Solo Caracteres Numericos."
                
            },
            
            telefono:{
                
                required:"Campo Requerido.",
                minlength:"Minimo De Caracteres 10",
                maxlength:"Maximo De caracteres 20",
                number:"Solo Caracteres Numericos."
                
            },
            
            email1:{
                required:"Campo Requerido.",
                email:"Solo Correos Electronicos.",
            },
            
            email2:{
                required:"Campo Requerido.",
                email:"Solo Correos Electronicos.",
                equalTo:"Los Correos Electronicos Deben Ser Iguales."
            }
            
        }
        
    });    
</script>
